<template>
  <div class="cart">
    <!--导航栏-->
    <nav-bar class="nav-bar">
      <div slot="center">购物车（{{length}}）</div>
    </nav-bar>

    <!--商品列表-->
    <cart-list></cart-list>

    <!--底部汇总-->
    <cart-bottom-bar  />

  </div>
</template>

<script>
import NavBar from "../../components/common/navbar/NavBar";
import { mapGetters } from 'vuex'

import CartList from "./childComps/CartList";
import CartBottomBar from "./childComps/CartBottomBar";

export default {
  name: "Cart",
  components:{
    CartList,
    NavBar,
    CartBottomBar
  },
  computed: {
    //把getters直接转变为computed
    //写数组的话名字都是一样的
    // ...mapGetters(['cartLength'])

    //写对象，可以自定义名字
    ...mapGetters({
      length: 'cartLength'
    })

  }
}
</script>


<style scoped>

  .nav-bar{
    background-color: #eb4868;
    color: #f2f2f2;
  }


</style>
